﻿import os;
def get_File_path(rootdir,suffix):
    dirs = [];
    for parent,dirnames,filenames in os.walk(rootdir):
        #for dirname in  dirnames:
            #print "parent is:" + parent;
            #print  "dirname is:" + dirname;
            #dirs.append(dirname);
        for filename in filenames:
            if os.path.splitext(filename)[1] == suffix:
                filePath = os.path.join(parent,filename);
                dirs.append(filePath.replace("\\","/"));
    return dirs;

def delFile(dir,suffix):
    files = get_File_path(dir,suffix);
    for file in files:
        print file
        os.remove(file)

if __name__ == "__main__":
    print("#######################del start#######################")
    files = get_File_path(".",".pyc");
    for file in files:
        print file
        os.remove(file)
    print("#######################del end#######################")
    raw_input()
